<template>
	<van-popup v-model:show="showPopup" position="center" @close="handleClose">
		<div class="popup-content">
			<div class="popup-title">企业绑定提醒</div>
			<div class="popup-message">您还未绑定企业信息，请先完成企业绑定后再使用相关功能。</div>
			<div class="popup-actions">
				<van-button type="default" @click="handleClose"> 稍后再说 </van-button>
				<van-button type="primary" @click="gotoBound"> 去绑定 </van-button>
			</div>
		</div>
	</van-popup>
</template>

<script>
import { computed } from 'vue'
import { useRouter } from 'vue-router'

export default {
	name: 'PopupBound',
	props: {
		show: {
			type: Boolean,
			default: false,
		},
	},
	emits: ['close', 'bound'],
	setup(props, { emit }) {
		const router = useRouter()

		const showPopup = computed({
			get: () => props.show,
			set: (value) => {
				if (!value) {
					emit('close')
				}
			},
		})

		const handleClose = () => {
			emit('close')
		}

		const gotoBound = () => {
			// 跳转到企业绑定页面
			router.push('/company/bound')
			emit('bound')
			emit('close')
		}

		return {
			showPopup,
			handleClose,
			gotoBound,
		}
	},
}
</script>

<style lang="less" scoped>
.popup-content {
	padding: 24px;
	width: 280px;
	text-align: center;
}

.popup-title {
	font-size: 18px;
	font-weight: bold;
	color: #333;
	margin-bottom: 16px;
}

.popup-message {
	font-size: 14px;
	color: #666;
	line-height: 1.5;
	margin-bottom: 24px;
}

.popup-actions {
	display: flex;
	gap: 12px;

	.van-button {
		flex: 1;
	}
}
</style>